#ifndef __ADC_MODULE_H__
#define __ADC_MODULE_H__

#include "common.h"
#include "global_config.h"

/* ADC channel definitions */
#define ADC_CHANNELS 4

/* ADC filter types */
typedef enum {
    FILTER_NONE = 0,
    FILTER_MOVING_AVERAGE,
    FILTER_EXPONENTIAL,
    FILTER_MEDIAN
} adc_filter_type_t;

/* ADC message types */
typedef enum {
    ADC_MSG_DATA_READY = 1,
    ADC_MSG_CALIBRATION,
    ADC_MSG_FILTER_CONFIG
} adc_msg_type_t;

/* ADC calibration structure */
typedef struct {
    uint8_t channel;
    float min_current;
    float max_current;
    float min_engineering;
    float max_engineering;
} adc_calibration_t;

/* Function declarations */
rt_err_t adc_module_init(void);
void adc_thread_entry(void *parameter);
float adc_get_engineering_value(uint8_t channel);
rt_err_t adc_set_calibration(uint8_t channel, float min_current, float max_current, 
                            float min_engineering, float max_engineering);
rt_err_t adc_set_filter_type(uint8_t channel, adc_filter_type_t type, uint8_t window_size);

/* External configuration access */
extern adc_config_t *adc_get_config(void);

#endif /* __ADC_MODULE_H__ */